shm[10000] //临界资源

sem, int lock = 1

//原子性！
//PV
proc1
if(lock ==1)
    lock--
else
    wait
//read ,write shm //code, 临界区
lock++;



proc2
if(lock ==1)
    lock--
else
    wait
//read,write shm //code, 临界区
lock++;
